async = require 'async'

func1 = (cb)->
  console.log 'cb 1:',1
  cb new Error,1
func2=(result,cb)->
  console.log 'cb 2:',result
  cb null,2,3
func3=(result1,result2,cb)->
  console.log 'cb 3:',result1,result2
  cb null,5

tasks = [func1,func2,func3]

callback = (err,result)->
  if err then console.error err
  else console.log result


async.waterfall(tasks,callback)

